#!/bin/bash

echo "install docker"
curl -sfL https://get.rainbond.com/install_docker | bash
docker info

echo "install docker-compose"
curl -SL https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version

echo "install git, wget"
yum -y install wget.x86_64
yum -y install git

echo "install Hadoop"
git clone https://gitee.com/hadoop-bigdata/docker-compose-hadoop.git
cd docker-compose-hadoop/hadoop
# 开始部署
# 这里-f docker-compose.yaml可以省略，如果文件名不是docker-compose.yaml就不能省略，-d 后台执行
docker-compose -f docker-compose.yaml up -d
# 查看部署状态
docker-compose -f docker-compose.yaml ps

echo "download hadoop, hive, flink, jdk"
# jdk
wget https://repo.huaweicloud.com/java/jdk/8u202-b08/jdk-8u202-linux-x64.tar.gz --no-check-certificate
# hadoop
wget https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/hadoop-3.3.5/hadoop-3.3.5.tar.gz --no-check-certificate
# hive
wget https://mirrors.tuna.tsinghua.edu.cn/apache/hive/hive-3.1.3/apache-hive-3.1.3-bin.tar.gz --no-check-certificate
# spark
wget https://mirrors.tuna.tsinghua.edu.cn/apache/spark/spark-3.4.3/spark-3.4.3-bin-hadoop3.tgz --no-check-certificate
# flink
wget https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.17.2/flink-1.17.2-bin-scala_2.12.tgz --no-check-certificate
# redis
wget http://download.redis.io/releases/redis-7.0.3.tar.gz --no-check-certificate

